MapCenter.tsx ➔ MapCenter   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 9
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 9
dl 0
loc 9
ccs 4
cts 4
cp 1
crap 1
rs 9.95
c 0
b 0
f 0
1
import { useMap } from 'react-leaflet';
2
import { LatLngExpression } from 'leaflet';
3
import { useEffect } from 'react';
4
5
export default function MapCenter({ center, zoom }: { center: LatLngExpression; zoom: number }) {
6 6
    const map = useMap();
7
8 6
    useEffect(() => {
9 6
        map.setView(center, zoom);
10
    }, [center, zoom, map]);
11
12 6
    return null;
13
}
14